#include<bits/stdc++.h>
using namespace std;

#define int long long

int n;
int r[100015];
int js[100015];
int ans=0;

signed main(){
	freopen("duel.in","r",stdin);
	freopen("duel.out","w",stdout);

	scanf("%lld",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld",&r[i]);
	}
	sort(r+1,r+n+1);
	int last_num=r[1];
	int length=1;
	int ds=0;
	for(int i=2;i<=n+1;i++){
		if(last_num==r[i])length++;
		else{
			ds++;
			//cout<<"\n";
			//cout<<length<<"\n";
			last_num=r[i];
			js[ds]=length;
			length=1;
			//cout<<js[ds]<<" "<<js[ds-1]<<"\n";
			ans+=min(js[ds],i-1-js[ds]-ans);
			//cout<<min(js[ds],js[ds-1])<<" "<<ans<<"\n";
			//cout<<min(js[ds],js[ds-1])<<endl;
		}

		//cout<<r[i-1]<<" ";
	}
	printf("%lld\n",n-ans);
	return 0;
}